﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DeJC.BLL.Managers;
using DeJC.DAL.Model;
using TheList.Helper;

namespace TheList.Controllers
{
    public class ConfigController : Controller
    {
        //
        // GET: /Config/

        public ActionResult Index()
        {
            //GeneralMiscTypeManager generalMiscTypeManager = new GeneralMiscTypeManager();
            
            return View(GeneralMiscTypeManager.GetParents());
        }

        public ActionResult CreateParent()
        {
            return View(); 
        }

        [HttpPost]
        public ActionResult CreateParent(GeneralMiscType generalMiscType) {
            if(ModelState.IsValid)
            {
                generalMiscType.Enabled = true;
                generalMiscType.ParentID = 0;
                generalMiscType.CreatedBy = Utility.GetCurrentUserId;
                generalMiscType.CreationDate = DateTime.Now;
                generalMiscType.Deleted = false;
                GeneralMiscTypeManager.AddGeneralMiscType(generalMiscType);
            }
            return View();
        }

    }
}
